﻿@model IEnumerable<IosDatamodel.VideoSheet>

@{
    ViewBag.Title = "Index";
}
<!DOCTYPE html>
    <link href="@Url.Content("~/Scripts/uploadify-v3.1/uploadify.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/uploadify-v3.1/jquery.uploadify-3.1.min.js")" type="text/javascript"></script><h2>Index</h2>
<body>
<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th>
            Name
        </th>
        <th>
            Image
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Image)
        </td>
            <td>

 <script type="text/javascript">
     var auth = "@(Request.Cookies[FormsAuthentication.FormsCookieName]==null ? string.Empty : Request.Cookies[FormsAuthentication.FormsCookieName].Value)";
     var ASPSESSID = "@Session.SessionID";

     $(function () {
         $('#@item.Id').uploadify({
            'auto': false,
            'formData': { 'videoid': '@item.Id', 'ASPSESSID': ASPSESSID, 'AUTHID': auth },
            'buttonText': '请选择图片',
                'swf': '@Url.Content("~/Scripts/uploadify-v3.1/uploadify.swf")',
                'uploader': '/VideoSheet/AddImage',
               @* 'buttonImage': '@Url.Content("~/Scripts/uploadify-v3.1/browse-btn.png")',*@
             'fileTypeDesc': '图片文件',
            'method': 'post',
            'fileTypeExts': '*.gif; *.jpg; *.png;*.gif;*.bmp;*.swf',
            'onUploadComplete': function (file) {
                $('#showvideo').html('图片 ' + file.name + ' 成功上传！');
            }
            //'onQueueComplete': function (queueData) {
            //    $('#showimage').html(queueData.uploadsSuccessful + '个图片已经成功上传！.');
            //}
        });
    });
</script>
   上传图片:
<span style="color:red">
    <input style="color:red" type="file" id='@item.Id'  name="image_upload" /></span>
@*<div>
    <a href="javascript:$('#image_upload').uploadify('upload');">上传</a> 
</div>*@
    <span>
    <a href="javascript:$('#@item.Id').uploadify('upload','*');">上传</a> 
    <a href="javascript:$('#@item.Id').uploadify('cancel', '*');">取消</a>
</span>

            </td>
    </tr>
}

</table>

    </body>
